home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / source / gutil / perror.c < prev    next >
Encoding:
C/C++ Source or Header  |  1985-01-23  |  532 b   |  33 lines

  1. # include    <sccs.h>
  2.  
  3. SCCSID(@(#)perror.c    8.1    12/31/84)
  4.  
  5. /*
  6.  * Print the error indicated
  7.  * in the cerror cell.
  8.  * ----
  9.  * this code stolen from the system perror, the only change is that we print
  10.  * on 1, instead of 2 (which is usally closed).
  11.  */
  12.  
  13. int    errno;
  14. int    sys_nerr;
  15. char    *sys_errlist[];
  16. perror(s)
  17. char *s;
  18. {
  19.     register char *c;
  20.     register n;
  21.  
  22.     c = "Unknown error";
  23.     if(errno < sys_nerr)
  24.         c = sys_errlist[errno];
  25.     n = strlen(s);
  26.     if(n) {
  27.         write(1, s, n);
  28.         write(1, ": ", 2);
  29.     }
  30.     write(1, c, strlen(c));
  31.     write(1, "\n", 1);
  32. }
  33.